﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class User_SPwdUpdate : INTPage
{
    Login comLogin = new Login();
    protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void cmdEdit_Click(object sender, EventArgs e)
    {
        CommonMethod.IsTimeOutUserCode(this, CommonModel.errorTimeOutUrl1);
        string userno = Session["UserCode"].ToString();
        int result = comLogin.SelectPwd(userno, Login.EncryptPassword(txtPwd.Text.Trim().ToString(), Login.PasswordType.MD5));
        if (result>0)
        {
            result = comLogin.EditPwd(userno, Login.EncryptPassword(txtPwd1.Text.Trim().ToString(), Login.PasswordType.MD5));
            if (result > 0)
            {
                CommonMethod.regAlertMessage("修改成功-Success!", this);
            }
            else
            {
                CommonMethod.regAlertMessage("修改失败-Failed updated!", this);
                cmdEdit.Focus();
            }
        }
        else
        {
            CommonMethod.regAlertMessage("原密码错误--Please check the original password!", this);
            txtPwd.Focus();
        }
    }
}
